/**
 * 
 */
package cvcg.util;

import org.apache.click.Context;
import org.apache.click.control.Decorator;

import cvcg.dto.VoteResultDTO;

/**
 * @author jaracje
 *
 */
public class VoteResultDecorator implements Decorator 
{
	private String columnName;
	/* (non-Javadoc)
	 * @see org.apache.click.control.Decorator#render(java.lang.Object, org.apache.click.Context)
	 */
	public VoteResultDecorator(String columnName) 
	{
		this.columnName = columnName;
	}
	@Override
	public String render(Object object, Context context) {
		VoteResultDTO dto = (VoteResultDTO) object;
		String deco=null;
		if (dto.isVoter(columnName)) 
		{
			deco = "<IMG alt=\"voted\" src=\"../assets/images/add_vote.png\"/>";
		}
		return deco;
	}

}
